<?php

use think\migration\Migrator;
use think\migration\db\Column;

class StoreTable extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('store');
        $table->addColumn('store_name','string',array('limit' => 100, 'comment' => '店铺名称'));
        $table->addColumn('store_logo','string',array('limit' => 255, 'comment' => '店铺logo'));
        $table->addColumn('id_number','char',array('limit' => 18, 'comment' => '身份证号'));
        $table->addColumn('legal_person','string',array('limit' => 30, 'comment' => '法人姓名'));
        $table->addColumn('id_card_front','string',array('limit' => 255, 'comment' => '身份证正面'));
        $table->addColumn('id_card_reverse','string',array('limit' => 255, 'comment' => '身份证反面'));
        $table->addColumn('business_license','string',array('limit' => 255,'comment' => '营业执照'));
        $table->addColumn('company_name','string',array('limit' => 100,'comment' => '公司名称'));
        $table->addColumn('company_address','string',array('limit' => 255,'comment' => '公司地址'));
        $table->addColumn('legal_phone','char',array('limit' => 11,'comment' => '法人手机号'));
        $table->addColumn('status','boolean',array('limit' => 1,'comment' => '店铺状态 0 下线 1 上线'));
        $table->addTimestamps('create_time','update_time');
        $table->addSoftDelete();
        $table->create();
    }
}
